package com.acc.store.service.impl;

import com.acc.store.entity.Supplier;
import com.acc.store.mapper.SupplierMapper;
import com.acc.store.service.SupplierService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author 10067
 * @description 针对表【supplier(供应商表)】的数据库操作Service实现
 * @createDate 2023-10-13 18:05:18
 */
@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier>
        implements SupplierService {

    @Override
    public IPage getPage(Map<String, Object> params) {
        Long page = Long.valueOf((String) params.get("page"));
        Long limit = Long.valueOf((String) params.get("limit"));
        Object key = params.get("key");
        Page<Supplier> thePage=null;
        //封装查询语句
        if (key != null) {
            thePage = lambdaQuery().like(Supplier::getPhone, key)
                    .or()
                    .like(Supplier::getName, (String)key)
                    .page(new Page<>(page, limit));

        }


        return thePage;
    }
}




